import {FieldErrorList, RuleItem} from 'async-validator';
import {ValidateFieldCallback} from 'element-plus/lib/el-form/src/token';
import {defineComponent} from 'vue';

export interface ElOtherRuleItem {
  trigger?: string | string[];
}
type Callback = (isValid?: boolean, invalidFields?: FieldErrorList) => void;
export declare type ElRuleItem = RuleItem | ElOtherRuleItem;

interface ElFormType {
  validate: (callback?: Callback) => Promise<boolean>;
  resetFields: () => void;
  clearValidate: (props?: string | string[]) => void;
  validateField: (props: string | string[], cb: ValidateFieldCallback) => void;
}

export declare type ElFormComponent = ElFormType | ReturnType<typeof defineComponent>;
